namespace Fusion.Utilities.Singleton
{
    public class Singleton<T> where T : Singleton<T>, new()
    {
        protected static T instance;
        protected static readonly object lockObject = new object();
        public static T Instance {
            get
            {
                if (instance == null)
                {
                    lock (lockObject)
                    {
                        if (instance == null)
                        {
                            instance = new T();
                            instance.Initializate();
                        }
                    }   
                }
                return instance;
            }
        }

        public virtual void Initializate()
        {

        }
    }

}

